package com.kuang.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kuang.entity.AchievementType;
import com.kuang.entity.Params;
import com.kuang.mapper.AchievementTypeMapper;
import com.kuang.mapper.SysUserMapper;
import com.kuang.service.AchievementTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AchievementTypeServiceImpl implements AchievementTypeService {
    @Resource
    private AchievementTypeMapper achievementTypeMapper;
    @Autowired
    private AchievementTypeMapper achievementType;

    /**
    * 查看成果类别表全部数据(包含逻辑删除的)
    * */
    public List<AchievementType> getAchievementTypeAll(){
        List<AchievementType> achievementTypes = achievementTypeMapper.selectAll();
        return achievementTypes;
    }

    /**
     *类别全部数据查询（没有被逻辑删除的）
     * **/
    @Override
    public List<AchievementType> findAchievementTypeAll() {
        List<AchievementType> list = achievementTypeMapper.findAchievementTypeAll();
        return list;
    }

    /**
     * 类别分页查询
     **/
    @Override
    public PageInfo findTypeAll(Params params) {
        PageHelper.startPage(params.getPageNum(), params.getPageSize());
        List<AchievementType> list = achievementType.findTypeAll(params);
        return PageInfo.of(list);
    }

    /**
     * 类别添加
     **/
    @Override
    public void findTypeAdd(AchievementType achievement_type) {
        achievementType.findTypeAdd(achievement_type);
    }

    /**
     * 类别删除
     **/
    @Override
    public void deleteById(Integer id) {
        achievementType.deleteById(id);

    }

    /**
     * 类别修改
     **/
    @Override
    public void updateById(AchievementType achievement_type) {
        achievementType.updateById(achievement_type);
    }



}
